<?php
class GetcategoryController extends Controller {
	
	public function __construct($data) {
        parent::__construct($data);

    }
  
public function index() {
		require_once( '../system/ecjp_m.php' );
		    
		  $id = htmlspecialchars($this->g['id']);
		  if( !is_numeric($id) ) exit;
		  $this->_load_php_file("Class_DB.php");
	      $db = new Class_DB;
		         
           $sql = sprintf( "SELECT * FROM  m_categorygood WHERE category_cd = %u", $id );
           $db->query( $sql );
           
           $body = "";
           while( $row = $db->fetch() ){
	             $body .= "{ id: '" . $row['category_cd'] . "', name: '" . $row['category_name'] . "' },";
          }
             $body = substr( $body, 0, strlen( $body ) -1 );
             header('Content-Type: text/plain; charset=UTF-8;');
             print "{[";
             print $body;
             print "]}";
        } 
}
?>